package com.itheima.reggie.common;
/**
* @Description: 基于ThreadLocal封装工具类，用于保存和获取当前登录用户的id
        * @Param: 
        * @return: 
        * @Author: Lei
        * @Date: 
 */

public class BaseContext {

    private static ThreadLocal<Long> threadLocal=new ThreadLocal<>();
    
    
    /**
    * @Description: 设置值
            * @Param: 
            * @return: 
            * @Author: Lei
            * @Date: 
     */
    
    public static void setCurrentId(Long id){
        threadLocal.set(id);
    }

    
    
    /**
    * @Description: 获取值
            * @Param: 
            * @return: 
            * @Author: Lei
            * @Date: 
     */
    
    public static Long getCurrentId(){
        return threadLocal.get();
    }

}
